package org.frame.test;


public class Os {
    static int door =0;
    static int driver =0;
    public static void main(String[] args) {
        System.out.println("准备开车");
//        driver
        new Thread(()->{
            while(true){
                while(driver==0);
                driver--;
                System.out.println("启动，行驶，到站停车");
                door++;
            }
        }).start();
//        door
        new Thread(()->{
          while(true){
              System.out.println("关车门，售票");
              driver++;
              while(door==0);

              System.out.println("开车门，上下乘客");
              door--;
          }
        }).start();
    }
}
